/*
               File: AltaCarnet
        Description: Alta Carnet
             Author: GeneXus C# Generator version 10_2_1-58381
       Generated on: 8/28/2012 20:59:0.15
       Program type: Callable routine
          Main DBMS: sqlserver
*/
using System;
using System.Collections;
using GeneXus.Utils;
using GeneXus.Resources;
using GeneXus.Application;
using GeneXus.Metadata;
using GeneXus.Data;
using com.genexus;
using GeneXus.Data.ADO;
using GeneXus.Data.NTier;
using GeneXus.Data.NTier.ADO;
using System.Runtime.Remoting;
using GeneXus.WebControls;
using GeneXus.Http;
using GeneXus.Procedure;
using GeneXus.XML;
using GeneXus.Search;
using GeneXus.Encryption;
using GeneXus.Http.Client;
using System.Threading;
using System.Xml.Serialization;
using System.Data.SqlTypes;
using System.ServiceModel;
using System.Runtime.Serialization;
namespace GeneXus.Programs {
   public class altacarnet : GXProcedure
   {
      public altacarnet( )
      {
         context = new GxContext(  );
         DataStoreUtil.LoadDataStores( context);
         IsMain = true;
         context.SetDefaultTheme("GeneXusXEv2");
      }

      public altacarnet( IGxContext context )
      {
         this.context = context;
         IsMain = false;
      }

      public void release( )
      {
      }

      public void execute( ref short aP0_PeriodistaId ,
                           ref String aP1_PeriodistaNombre )
      {
         this.AV9PeriodistaId = aP0_PeriodistaId;
         this.AV11PeriodistaNombre = aP1_PeriodistaNombre;
         initialize();
         executePrivate();
         aP0_PeriodistaId=this.AV9PeriodistaId;
         aP1_PeriodistaNombre=this.AV11PeriodistaNombre;
      }

      public String executeUdp( ref short aP0_PeriodistaId )
      {
         this.AV9PeriodistaId = aP0_PeriodistaId;
         this.AV11PeriodistaNombre = aP1_PeriodistaNombre;
         initialize();
         executePrivate();
         aP0_PeriodistaId=this.AV9PeriodistaId;
         aP1_PeriodistaNombre=this.AV11PeriodistaNombre;
         return AV11PeriodistaNombre ;
      }

      public void executeSubmit( ref short aP0_PeriodistaId ,
                                 ref String aP1_PeriodistaNombre )
      {
         altacarnet objaltacarnet;
         objaltacarnet = new altacarnet();
         objaltacarnet.AV9PeriodistaId = aP0_PeriodistaId;
         objaltacarnet.AV11PeriodistaNombre = aP1_PeriodistaNombre;
         objaltacarnet.context.SetSubmitInitialConfig(context);
         objaltacarnet.initialize();
         ThreadPool.QueueUserWorkItem( new WaitCallback( executePrivateCatch ),objaltacarnet);
         aP0_PeriodistaId=this.AV9PeriodistaId;
         aP1_PeriodistaNombre=this.AV11PeriodistaNombre;
      }

      void executePrivateCatch( object stateInfo )
      {
         try
         {
            ((altacarnet)stateInfo).executePrivate();
         }
         catch ( Exception e )
         {
            GXUtil.SaveToEventLog( "Design", e);
            throw e ;
         }
      }

      void executePrivate( )
      {
         /* GeneXus formulas */
         /* Output device settings */
         AV10Carne.gxTpr_Periodistaid = AV9PeriodistaId ;
         AV10Carne.gxTpr_Carnenombre = AV11PeriodistaNombre ;
         AV10Carne.Save();
         this.cleanup();
      }

      public void cleanup( )
      {
         CloseOpenCursors();
         if ( IsMain )
         {
            context.CloseConnections() ;
         }
         exitApplication();
      }

      protected void CloseOpenCursors( )
      {
      }

      public override void initialize( )
      {
         AV10Carne = new SdtCarne(context);
         /* GeneXus formulas. */
         context.Gx_err = 0 ;
      }

      private short AV9PeriodistaId ;
      private String AV11PeriodistaNombre ;
      private short aP0_PeriodistaId ;
      private String aP1_PeriodistaNombre ;
      private SdtCarne AV10Carne ;
   }

}
